<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<div id="app">
  <cpn></cpn>
</div>

<template id="cpn">
  <div>
    <h2>我是cpn组件</h2>
    <ccpn></ccpn>
  </div>
</template>

<template id="ccpn">
  <div>
    <h2>我是一个子组件</h2>
    <button v-on:click="btnClick">按钮</button>
  </div>
</template>

<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      message: '123'
    },
    components: {
      cpn: {
        template: '#cpn',
        components: {
          ccpn: {
            template: '#ccpn',
            methods: {
              btnClick: function () {
                //访问父组件$parent
                console.log(this.$parent);
              }
            }
          }
        }
      }
    }
  })
</script>

</body>
</html>